package main

import (
	"mpps/tools/config"
	"mpps/tools/registry"
	"mpps/web/handler"
	"time"

	"github.com/asim/go-micro/v3/logger"
	"github.com/asim/go-micro/v3/web"
)

// @title Swagger API
// @version 1.0
// @description 后端接口API
// @host 127.0.0.1:8989
// @BasePath /
func main() {
	register := registry.GetRegistry()
	ginRouter := handler.InitRouter()

	srv := web.NewService(
		web.Secure(true),
		web.Name(config.WebSrv),
		web.Version("latest"),
		web.RegisterTTL(time.Second*30),
		web.RegisterInterval(time.Second*30),
		web.Address(config.G_httpaddr),
		web.Handler(ginRouter),
		web.Registry(register),
	)

	srv.Init()

	// Run service
	if err := srv.Run(); err != nil {
		logger.Fatal(err)
	}
}
